package com.itheima.reggie.service.impl;

import com.itheima.reggie.dao.EmployeeMapper;
import com.itheima.reggie.entity.Employee;
import com.itheima.reggie.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public Employee getEmployeeByName(String userName) {
        return employeeMapper.getByName(userName);
    }

    @Override
    public List<Employee> getList(String name) {
        return employeeMapper.getlistByName(name);
    }

    @Override
    public Employee getById(Long id) {
        return employeeMapper.getById(id);
    }

    @Override
    public void add(Employee employee) {
        employeeMapper.addEmployee(employee);
    }

    @Override
    public void update(Employee employee) {
        employeeMapper.updateEmployee(employee);
    }
}
